package com.zmn.plat.business.impl.sms;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zmn.common.dictionary.GlobalDict;
import com.zmn.plat.business.interfaces.sms.SmsTemplateBService;
import com.zmn.plat.model.entity.sms.SmsTemplate;
import com.zmn.plat.services.interfaces.sms.SmsTemplateService;

/**
 * Creator: nowind
 * 
 * @since 2018/7/13 13:49
 */
@Service
public class SmsTemplateBServiceImpl implements SmsTemplateBService {

    @Resource
    private SmsTemplateService smsTemplateService;

    @Override
    public Integer insert(SmsTemplate template) {

        template.setTemplateId(smsTemplateService.findKeyForMax());
        template.setSort(100);
        template.setStatus(GlobalDict.STATUS_ENABLE);

        int pos = smsTemplateService.insert(template);
        return pos > 0 ? template.getTemplateId() : 0;
    }
}
